<?php
$arcTagModel = new \Common\Model\ArcTag;
$arcModel = new \Common\Model\Arc;
//载入文章表模板
$arcdata = $arcModel -> join('article_data', 'aid', '=', 'article_aid') -> orderBy('click', 'DESC') -> limit(3) -> get();

$arcDataModel = new \Common\Model\ArcData;
//载入文章数据表
$arcdatadata = $arcDataModel -> get();

$tagModel = new \Common\Model\Tag;
$tagData = $tagModel -> get();
//获取标签表
foreach ($tagData as $k => $v) {
	//article_tag中间表和tag表关联
	$tagData[$k]['tagq'] = $arcTagModel -> where("tag_tid={$v['tid']}") -> join('article', 'article_aid', '=', 'aid') -> count();
}
?>

 <aside>
 	<!--推荐文章-->
      <div class="tuijian" style="height: 110px;">
        <h2>热门文章</h2>
    	<?php foreach ($arcdata as $v){?>
        <li> <a href="<?php echo U('Arc/index',array('aid'=>$v['aid']))?>"><?php echo $v['title']?></a></li>
   		 <?php }?>
      </div>
      <!--推荐文章结尾-->
      <div class="toppic">
        <h2>图文并茂</h2>
        <ul>
        	<?php foreach ($arcdata as $v){?>
         	 <li style="height: 41px;width: 280px;overflow: hidden;">
	          	<a href="<?php echo U('Arc/index',array('aid'=>$v['aid']))?>"><img  src="<?php echo $v['thumb']?>" />	
		   
	           <?php echo $v['des']?> </a>
            </li>
             <?php }?>
        </ul>
      </div>
      <div class="clicks" style="height: 100px;">
        <h2>标签云</h2>
        <ol>
          <li>
		      	<span>
		      		<div class="_tag" style="height: 20px">
						<?php foreach ($tagData as $v){?>
							<a href="t_<?php echo $v['tid']?>.html"><?php echo $v['tname']?> <?php if($v['tagq']){?>
                 (<?php echo $v['tagq']?>)
               <?php }?>
							</a>
				</span>
						<?php }?>
			</li>
		
        </ol>
      </div>
      <div class="search" style="height: 50px;">
        <form class="searchform" method="get" action="#">
          <input type="text" name="s" value="Search" onfocus="this.value=''" onblur="this.value='Search'">
        </form>
      </div>
      <div class="viny">
        <dl>
          <dt class="art"><img src="Public/Home/images/artwork.png" alt="专辑"></dt>
          <dd class="icon-song"><span></span>南方姑娘</dd>
          <dd class="icon-artist"><span></span>歌手：赵雷</dd>
          <dd class="icon-album"><span></span>所属专辑：《赵小雷》</dd>
          <dd class="icon-like"><span></span><a href="/">喜欢</a></dd>
          <dd class="music">
            <audio src="Public/Home/images/nf.mp3" controls></audio>
          </dd>
          <!--也可以添加loop属性 音频加载到末尾时，会重新播放-->
        </dl>
      </div>
    </aside>
